{% extends 'base.html.twig' %}
{% block title %}{{ title }}{% endblock %}

{% block body %}
    <h2> {{ title }} </h2>
    <table class="table">
        <tr>
            <th>收盘价: {{ tick['close'] }}</th>
            <th>开盘价: {{ tick['open'] }}</th>
            <th>最高: {{ tick['high'] }}</th>
            <th>最低: {{ tick['low'] }}</th>
            <th>交易量: {{ tick['vol'] }}</th>
            <th>时间: {{ tick['id']|date("Y-m-d H:i:s") }}</th>
        </tr>
    </table>
    <table class="table">
        <tr>
            <th>币种</th>
            <th>涨/跌</th>
            <th>价格</th>
            <th>通知时间</th>
        </tr>

        {% for row in data %}
            {% if row['direct'] == 'up' and (tick['close'] > row['price'] or tick['high'] > row['price']) %}
                <tr style="background: #8A3104">
            {% else %}
                <tr style="background: #2a4137">
            {% endif %}
            <td>{{ row['coin'] }}</td>
            <td>{{ row['direct'] }}</td>
            <td>{{ row['price'] }}</td>
            <td>{{ "now"|date("Y-m-d H:i:s") }} </td>
            </tr>
        {% endfor %}
    </table>
{% endblock %}

{% block stylesheets %}
    <style type="text/css">
        body, table {
            background: #C0C0C0;
            font-size: 12px;

        }

        table {
            table-layout: fixed;
            empty-cells: show;
            border-collapse: collapse;
            margin: 0 auto;
        }

        td {
            height: 30px;
        }

        h1, h2, h3 {
            font-size: 12px;
            margin: 0;
            padding: 0;
        }

        .table {
            border: 1px solid #cad9ea;
            color: #FFFFFF;
        }

        .table th {
            background: #2b2b2b;
            background-repeat: repeat-x;
            height: 30px;
        }

        .table td, .table th {
            border: 1px solid #cad9ea;
            padding: 0 1em 0;
        }

        .table tr.alter {
            background-color: #f5fafe;
        }
    </style>
{% endblock %}
